package com.ww.learn.coroutine

import kotlin.coroutines.Continuation
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.createCoroutine
import kotlin.coroutines.resume

fun main() {
    val continuation = suspend {
        println("in Coroutine.")
        5
    }.createCoroutine(object: Continuation<Int> {
        override fun resumeWith(result: Result<Int>) {
            println("Coroutine End: $result")
        }

        override val context = EmptyCoroutineContext
    })

    continuation.resume(Unit)
    continuation.resume(Unit)
    continuation.resume(Unit)
}